package com.gyg.executorDemo;

/**
 * 创建线程方式2：实现runnable接口
 */
public class TestThread03 implements Runnable {
    @Override
    public void run() {
        //run方法线程体
        for (int i = 0; i < 10; i++) {
            System.out.println("线程方法体-线程名：" + Thread.currentThread().getName());
        }
    }

    public static void main(String[] args) {
        //创建Runnable接口的实现类对象
        TestThread03 testThread03 = new TestThread03();
        //创建线程对象，通过线程对象来开启线程代理
        new Thread(testThread03).start();

        for (int i = 0; i < 10; i++) {
            System.out.println("主线程方法-线程名" + Thread.currentThread().getName());
        }
    }
}
